<% if current_user.can_view_forum?(forum) %>
  <tr class="<%= forum_dom_class(forum) %>">
    <td style="padding-left: <%= forum_left_padding(forum) %>" colspan="<%= forum.category? ? 3 : 1 %>">
      <%= link_to h(forum.name), forum_path(forum), :class => 'name' %>
      <span class="actions">
        <%= link_to 'edit', edit_forum_path(forum) if current_user.can_update_forum? forum %>
        <% if current_user.can_destroy_forum? forum %>
          | <%= link_to 'destroy', forum_path(forum), :confirm => 'Are you sure?', :method => 'delete' %>
        <% end %>
      </span>
      <div class="description"><%=h forum.description %></div>
    </td>
    <% unless forum.category? %>
      <td class="topic_count"><%= forum.topics.count %></td>
      <td class="last_post">
        <% unless forum.last_post.nil? %>
          <%= link_to_post(forum.last_post) %>
          by <%= link_to_user(forum.last_post.user) %>
        <% end %>
      </td>
    <% end %>
  </tr>
  <%= render :partial => 'forum', :collection => forum.children unless forum.depth >= 2 %>
<% end %>
